#include <stdio.h>

int getSum(int n , int a) ;

int main()
{
       int        n , a ; 

       scanf( "%d%d" , &n , &a );       
       printf( "%d\n" , getSum( n , a ) );

    return 0;
}

int getSum(int n , int a)
{
    int returnvalue;
    if(n==0) returnvalue=a+3*n;
    else returnvalue=getSum(n-1,a)+3*n+a;
    return returnvalue;
}